<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="业务对账单" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<link href="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.css" rel="stylesheet" type="text/css">
<script src="/js/popup_ext.js"></script>
<script src="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.js"></script>
<script language="javascript">
	function checkInput(){
		if(window.event.keyCode==13){
			doOk();
		}
	}
	function doOk(){
		var startDate=document.getElementById("start_date").value;
		if(startDate!=null && startDate!=''){
			var arr=startDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','开始日期格式不正确',200,100);
				return;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','开始日期格式不正确',200,100);
				return;
			}
		}
		
		var endDate=document.getElementById("end_date").value;
		if(endDate!=null && endDate!=''){
			var arr=endDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','结束日期格式不正确',200,100);
				return;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','结束日期格式不正确',200,100);
				return;
			}
		}
		
		var retArr=new Array();
		retArr[0]=startDate;
		retArr[1]=endDate;
		retArr[2]=document.getElementById("type").value;
		retArr[3]=document.getElementById("include_sub").value;
		retArr[4]=document.getElementById("order_by").value;
		retArr[5]=encodeURIComponent(document.getElementById("linkman").value);
		parent.popRetVal=retArr;
		parent.ClosePop();
	}
	function doCancel(){
		parent.ClosePop();
	}
	function setDate(type){
		var d=new Date();
		var startStr="";
		var endStr="";
		
		if(type=="PREVIEW_MONTH"){
			d=new Date(d.getFullYear(),d.getMonth(),1);
			d.setDate(d.getDate()-1);
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-1";
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="CURRENT_MONTH"){
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-01";
			d=new Date(d.getFullYear(),d.getMonth()+1,1);
			d.setDate(d.getDate()-1);
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="END_PREVIEW_MONTH"){
			d=new Date(d.getFullYear(),d.getMonth(),1);
			d.setDate(d.getDate()-1);
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="END_CURRENT_DATE"){
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}
		document.getElementById("start_date").value=startStr;
		document.getElementById("end_date").value=endStr;
	}
	function doInit(){
		document.getElementById("linkman").focus();
	}
</script>
</head>
<body oncontextmenu="return false" onload="doInit();" onKeyUp="checkInput();" class="sheet modal-dialog" style="padding-top:10px;text-align:left;">
<div class="sheet-main" id="bodyDiv" style="width:315px;">
	  <div class="sheet-list" style="width:100%">
	    <div class="modal-main search-business">
	    	<div style="width:100%;">
				<c:set var="pageTopTitle" value="业务对帐单" />
				<c:set var="pageTopMark" value="" />
				<%@ include file="../inc/PageTop.jsp"%>
				<table border="0" cellspacing="1" cellpadding="1" align="center" class="table-a">
						<tr>
							<th>开始日期：</th>
							<td>
								<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" id="start_date" name="start_date" value="${start_date}">
								<img src="/images/calendar.gif" style="cursor:pointer" onClick="displayCalendar(document.getElementById('start_date'),'yyyy-mm-dd',document.getElementById('start_date'));">
							</td>
						</tr>	
						<tr>
							<th>结束日期：</th>
							<td>
								<input type="text"  class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" id="end_date" name="end_date" value="${end_date}">
								<img src="/images/calendar.gif" style="cursor:pointer" onClick="displayCalendar(document.getElementById('end_date'),'yyyy-mm-dd',document.getElementById('end_date'));">
							</td>
						</tr>
						<tr>
							<th></th>
							<td>
								<a href="javascript:setDate('PREVIEW_MONTH');">上月</a>
								<a href="javascript:setDate('CURRENT_MONTH');">本月</a>
								<a href="javascript:setDate('END_PREVIEW_MONTH');">截止上月</a>
								<a href="javascript:setDate('END_CURRENT_DATE');">截止当天</a>
							</td>
						</tr>
						<tr>
							<th>联系人：</th>
							<td>
								<input type="text" class="TextBox" maxlength="15" onKeyUp="checkInput();" id="linkman" name="linkman" value="${linkman}">
							</td>
						</tr>
						<tr>
							<th>查询类型：</th>
							<td>
								<select name="type" id="type">
									<option value="JUST_UNCOLLECTED">只显示未收完款的业务单</option>
									<option value="">包括已收完款的业务单</option>
									<option value="JUST_UNCLOSED">不包括已结清的业务单</option>
									<option value="JUST_NORECE">不包括开过收款单的业务单</option>
								</select>
							</td>
						</tr>
						<tr>
							<th>下属单位：</th>
							<td>
								<select name="include_sub" id="include_sub">
									<option value="1">包括</option>
									<option value="0">不包括</option>
								</select>
							</td>
						</tr>
						<tr>
							<th>排序类型：</th>
							<td>
								<select name="order_by" id="order_by">
									<option value="DATE_ASC">日期升序</option>
									<option value="DATE_DESC">日期降序</option>
								</select>
							</td>
						</tr>
				</table>
			</div>
	  	</div>
	  </div>
		<div class="modal-buttom">
			<input type="button" class="buttom-a" value=" 确 定 " onClick="doOk();" id="okButton">
			<input type="button" class="buttom-a" value=" 取 消 " onClick="doCancel();">
		</div>
</div>			   	
</body>
</html>